define(['app'], function(app) {
	'use strict';

	//实例化方法
	var factory = function(Http) {
		function get_data_bankDataEdit(result) {
			if(false) {
				result = '{"success": true,"msg": "","result": {"id": "001"},"session": "7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			} else {
				return result;
			}
		};
		function get_data_bank_detail(result){
			if(false){
				result = '{"success":true,"msg":"","result":{"id":"001","bank_name":"工商银行","bank_no":"134567890","account_name":"李某某","phone":"126589715"},"session":"7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			}else
			return result;
		}
		
		return {
			//新增银行账号地址
			bankdata_edit: function(id,account_name,bank_name,bank_no,phone,def_bank,callback) {
				var updateParams = new Object();
				updateParams.id = id;
				updateParams.bank_name = bank_name;
				updateParams.bank_no = bank_no;
				updateParams.account_name = account_name;
				updateParams.phone = phone;
				updateParams.def_bank = def_bank;
				updateParams = JSON.stringify(updateParams);
				//post请求
				Http.post({
						method: 'member.bankdata.edit',
						updateParams:updateParams
					}, function(result) {
						//函数回调
						if(callback)
							callback(get_data_bankDataEdit(result));

					}, function(e) {

					}, function() {

					}
				);
			},
			//详情
			bank_detail:function(id,callback){
				Http.post({
					method:'member.bankdata.detail',
					id:id
				},function(result){
					if(callback)
						callback(get_data_bank_detail(result).result);
				},function(e){
					
				},function(){
					
				})
			}
		};
	}

	factory.$inject = ['Http'];
	return app.registerService("T_address_add_yh", factory);
});